home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / nihcl-30.lha / nihcl-3.0 / ex / Makefile < prev    next >
Makefile  |  1990-05-20  |  9KB  |  345 lines

  1. # $Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/ex/RCS/Makefile,v 3.0 90/05/20 21:05:15 kgorlen Rel $
  2. # C++ compiler
  3. CC = CC
  4.  
  5. # C++ debug switch
  6. CCDEBUG =
  7. #CCDEBUG = -g
  8.  
  9. # C++ flags
  10. # NOTE: Disable +p option when compiling with AT&T R2.1
  11. CCFLAGS = +p
  12. #CCFLAGS =
  13.  
  14. # C++ include files
  15. I = /usr/include/CC
  16.  
  17. # If using BSD
  18. SYS = BSD
  19. # If using System V
  20. #SYS = SYSV
  21.  
  22. # Compile with nested types (works with AT&T R2.1 and GNU C++)
  23. NESTED_TYPES =
  24. #NESTED_TYPES = -DNESTED_TYPES
  25.  
  26. # Disable AT&T R2.0/R2.1 bug work-around code
  27. BUGDEFS =
  28.  
  29. # Enable debug code
  30. DEBUGDEFS =
  31.  
  32. NIHCLINCDIR = /usr/include/nihcl
  33. NIHCLLIBDIR = /usr/local/lib
  34. NIHCLVECINCDIR = ${NIHCLINCDIR}
  35. NIHCLLIB = ${NIHCLLIBDIR}/libnihcl.a
  36. NIHCLMILIB = ${NIHCLLIBDIR}/libnihclmi.a
  37. NIHCLVECLIB = ${NIHCLLIBDIR}/libnihclvec.a
  38.  
  39. CFLAGS = -I${NIHCLINCDIR} ${CCDEBUG} ${CCFLAGS} ${NESTED_TYPES} ${BUGDEFS} ${DEBUGDEFS}
  40. LFLAGS = -lm ${CCDEBUG}
  41.  
  42. include progs.all
  43. include classes.all
  44.  
  45. .SUFFIXES: ..c .s .C
  46. .c:
  47.     $(CC) $(CFLAGS) $< -o $* $(LFLAGS)
  48. .c.o:
  49.     $(CC) $(CFLAGS) -c $<
  50. .C.o:
  51.     $(CC) $(CFLAGS) -c $<
  52. .c..c:
  53.     ${CC} ${CFLAGS} +i -c $<
  54. .c.s:
  55.     ${CC} ${CFLAGS} +i -S $<
  56.  
  57. all:${CLASSES} ${PROGS} ${SUBDIRS}
  58.  
  59. # C program to add ints
  60. ex2-1.o: ex2-1.c
  61.     cc ${CCDEBUG} -c $<
  62.  
  63. ex2-1: $$@.o
  64.     cc $@.o -o $@ ${LFLAGS}
  65.  
  66. # C program to add multiple-precision integers using mp library
  67. ex2-2.o: ex2-2.c
  68.     cc ${CCDEBUG} -c $<
  69.  
  70. ex2-2: $$@.o
  71.     cc $@.o -o $@ -lmp ${LFLAGS}
  72.  
  73. # C++ program to add instances of class BigInt
  74. ex2-3: $$@.o BigInt.o
  75.     $(CC) $@.o -o $@ BigInt.o ${LFLAGS}
  76.  
  77. # Writing to the standard output stream
  78. ex5-1: $$@.o
  79.     $(CC) $@.o -o $@ ${LFLAGS}
  80.  
  81. # Reading from the standard input stream
  82. ex5-2: $$@.o
  83.     $(CC) $@.o -o $@ ${LFLAGS}
  84.  
  85. # Writing a BigInt to the standard output
  86. ex5-3: $$@.o BigInt.o
  87.     $(CC) $@.o -o $@ BigInt.o ${LFLAGS}
  88.  
  89. # Extending stream I/O for class BigInt
  90. ex5-4: $$@.o BigInt.o
  91.     $(CC) $@.o -o $@ BigInt.o ${LFLAGS}
  92.  
  93. # Opening a stream for an output file
  94. ex5-5: $$@.o
  95.     $(CC) $@.o -o $@ ${LFLAGS}
  96.  
  97. # String substitution
  98. ex5-6: $$@.o ExString.o
  99.     $(CC) $@.o -o $@ ExString.o ${LFLAGS}
  100.  
  101. # Find dates of working days
  102. ex5-7: $$@.o ${NIHCLLIB}
  103.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  104.  
  105. # Vector operations
  106. ex5-8.o: ex5-8.c
  107.     $(CC) $(CFLAGS) -I${NIHCLVECINCDIR} -c $*.c
  108.  
  109. ex5-8: $$@.o ${NIHCLLIB} ${NIHCLVECLIB}
  110.     $(CC) $@.o -o $@ ${NIHCLVECLIB} ${NIHCLLIB} ${LFLAGS}
  111.  
  112. # Matrix algebra with Class Matrix
  113. ex5-9: $$@.o Matrix.o
  114.     $(CC) $@.o -o $@ Matrix.o ${LFLAGS}
  115.  
  116. # One dimensional automatic derivatives with class AutoDeriv
  117. ex5-10: $$@.o AutoDeriv.o
  118.     $(CC) $@.o -o $@ AutoDeriv.o ${LFLAGS}
  119.  
  120. # Newton's method with Partial automatic derivatives
  121. ex5-11: $$@.o ArrayPartial.o Partial.o Matrix.o
  122.     $(CC) $@.o -o $@ ArrayPartial.o Partial.o Matrix.o ${LFLAGS}
  123.  
  124. # Geometry class hierarchy
  125. ex6-1: $$@.o 
  126.     $(CC) $@.o -o $@ ${LFLAGS}
  127.  
  128. # Improved geometry class hierarchy
  129. ex6-2: $$@.o
  130.     $(CC) $@.o -o $@ ${LFLAGS}
  131.  
  132. # Order of construction of base and member classes
  133. ex6-3: $$@.o
  134.     $(CC) $@.o -o $@ ${LFLAGS}
  135.  
  136. # Calling a virtual function from a base class constructor
  137. ex6-4: $$@.o
  138.     $(CC) $@.o -o $@ ${LFLAGS}
  139.  
  140. # Geometry class hierarchy using NIH class library
  141. ex7-1: $$@.o ${NIHCLLIB}
  142.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  143.  
  144. #  Improved geometry class hierarchy using NIH class library
  145. ex7-2: $$@.o Circle.o Line.o Picture.o Shape.o ${NIHCLLIB}
  146.     $(CC) $@.o Circle.o Line.o Picture.o Shape.o -o $@ ${NIHCLLIB} ${LFLAGS}
  147.  
  148. #  Object I/O readFrom()
  149. ex7-3: $$@.o Circle.o Line.o Picture.o Shape.o ${NIHCLLIB}
  150.     $(CC) $@.o Circle.o Line.o Picture.o Shape.o -o $@ ${NIHCLLIB} ${LFLAGS}
  151.  
  152. #  Description of a Patient object
  153. ex8-1: $$@.o Patient.o ${NIHCLLIB}
  154.     $(CC) $@.o Patient.o -o $@ ${NIHCLLIB} ${LFLAGS}
  155.  
  156. #  Use of an Iterator with container for objects of unknown class
  157. ex8-2: $$@.o ${NIHCLLIB}
  158.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  159.  
  160. #  Nested Iterators
  161. ex8-3: $$@.o ${NIHCLLIB}
  162.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  163.  
  164. #  Incorrectly modifying a container during iteration
  165. ex8-4: $$@.o ${NIHCLLIB}
  166.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  167.  
  168. #  Modifying a container during iteration
  169. ex8-5: $$@.o ${NIHCLLIB}
  170.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  171.  
  172. #  Sequential access to Objects in an OrderedCltn
  173. ex8-6: $$@.o Patient.o ${NIHCLLIB}
  174.     $(CC) $@.o Patient.o -o $@ ${NIHCLLIB} ${LFLAGS}
  175.  
  176. #  Sorting Patient records by name
  177. ex8-7: $$@.o Patient.o ${NIHCLLIB}
  178.     $(CC) $@.o Patient.o -o $@ ${NIHCLLIB} ${LFLAGS}
  179.  
  180. #  Sorting Patient records with a KeySortCltn
  181. ex8-8: $$@.o Patient.o ${NIHCLLIB}
  182.     $(CC) $@.o Patient.o -o $@ ${NIHCLLIB} ${LFLAGS}
  183.  
  184. #  Sorting on Multiple Keys with ArrayOb and KeySortCltn
  185. ex8-9: $$@.o Patient.o ${NIHCLLIB}
  186.     $(CC) $@.o Patient.o -o $@ ${NIHCLLIB} ${LFLAGS}
  187.  
  188. #  Linking into a LinkedList
  189. ex8-10: $$@.o ${NIHCLLIB}
  190.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  191.  
  192. #  Test if date falls on a weekday
  193. ex8-11: $$@.o ${NIHCLLIB}
  194.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  195.  
  196. #  Binary Set operators
  197. ex8-12: $$@.o Patient.o ${NIHCLLIB}
  198.     $(CC) $@.o Patient.o -o $@ ${NIHCLLIB} ${LFLAGS}
  199.  
  200. # Comparison of classes Set and IdentSet
  201. ex8-13: $$@.o ${NIHCLLIB}
  202.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  203.  
  204. #  A Dictionary of Patient records keyed by name
  205. ex8-14: $$@.o Patient.o ${NIHCLLIB}
  206.     $(CC) $@.o Patient.o -o $@ ${NIHCLLIB} ${LFLAGS}
  207.  
  208. # Comparison of classes Dictionary and IdentDict
  209. ex8-15: $$@.o ${NIHCLLIB}
  210.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  211.  
  212. #  Property list
  213. ex8-16: $$@.o Patient.o ${NIHCLLIB}
  214.     $(CC) $@.o Patient.o -o $@ ${NIHCLLIB} ${LFLAGS}
  215.  
  216. # Class ArrayOb example
  217. ex9-1: $$@.o ArrayOb.o ${NIHCLLIB}
  218.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  219.  
  220. # Incorrect handling of member pointers to class instances
  221. ex9-2: $$@.o ${NIHCLLIB}
  222.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  223.  
  224. # Correct handling of member pointers to class instances
  225. ex9-3: $$@.o ${NIHCLLIB}
  226.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  227.  
  228. # Virtual inline function calls
  229. ex9-4: $$@.o
  230.     $(CC) $@.o -o $@ ${LFLAGS}
  231.  
  232. # Variations of isEqual()
  233. ex10-1K.o: ex10-1K.c
  234.     $(CC) $(CFLAGS) -c -DKINDOF $*.c
  235.  
  236. ex10-1S.o: ex10-1S.c
  237.     $(CC) $(CFLAGS) -c -DSTRICT $*.c
  238.  
  239. ex10-1SK.o: ex10-1SK.c
  240.     $(CC) $(CFLAGS) -c -DSTRICT -DKINDOF $*.c
  241.  
  242. ex10-1: $$@.o ${NIHCLLIB}
  243.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  244.  
  245. ex10-1K: $$@.o ${NIHCLLIB}
  246.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  247.  
  248. ex10-1S: $$@.o ${NIHCLLIB}
  249.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  250.  
  251. ex10-1SK: $$@.o ${NIHCLLIB}
  252.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  253.  
  254. # Scheduling lightweight processes in the NIH class library
  255. ex11-1: $$@.o
  256.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  257.  
  258. # Managing N resources with a Semaphore
  259. ex11-2: $$@.o
  260.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  261.  
  262. # Protecting a critical section of code with an AutoSignal
  263. ex11-3: $$@.o
  264.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  265.  
  266. # Communication between lightweight processes with a SharedQueue
  267. ex11-4: $$@.o
  268.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  269.  
  270. # Class Vehicle with multiple links
  271. ex13-1: $$@.o
  272.     $(CC) $@.o -o $@ ${LFLAGS}
  273.  
  274. # Improved vehicle linked lists
  275. ex13-2: $$@.o
  276.     $(CC) $@.o -o $@ ${LFLAGS}
  277.  
  278. # Virtual functions and multiple inheritance
  279. ex13-3: $$@.o
  280.     $(CC) $@.o -o $@ ${LFLAGS}
  281.  
  282. # Class AmphibiousVehicle with virtual base class
  283. ex13-4: $$@.o
  284.     $(CC) $@.o -o $@ ${LFLAGS}
  285.  
  286. # Virtual base classes and virtual functions
  287. ex13-5: $$@.o
  288.     $(CC) $@.o -o $@ ${LFLAGS}
  289.  
  290. # Order of construction of multiple base, virtual base, and member classes
  291. ex13-6: $$@.o
  292.     $(CC) $@.o -o $@ ${LFLAGS}
  293.  
  294. # Calling a virtual function from a base class constructor
  295. ex13-7: $$@.o
  296.     $(CC) $@.o -o $@ ${LFLAGS}
  297.  
  298. # Static method for avoiding undesired multiple calls to member functions of virtual base classes
  299. ex13-8: $$@.o
  300.     $(CC) $@.o -o $@ ${LFLAGS}
  301.  
  302. # MI with the NIH Class Library
  303.  
  304. VEHICLEOBJS = AllLink.o AllVehicles.o AmphibVhcl.o DrawBridgeQ.o LandVhcl.o QLink.o StopLightQ.o Vehicle.o VehicleQ.o WaterVhcl.o
  305.  
  306. # Hack to make stdarg work on sparc
  307.  
  308. Vehicle.o: Vehicle.c
  309. #    ${CC} ${CFLAGS} -F -c Vehicle.c | sed -e 's/__0__builtin/__builtin/g' >Vehicle..c
  310.     ${CC} -I${NIHCLINCDIR} ${CCFLAGS} ${NESTED_TYPES} ${BUGDEFS} ${DEBUGDEFS} -F -c Vehicle.c | sed -e 's/__0__builtin/__builtin/g' >Vehicle..c
  311.     cc ${CCDEBUG} -c -o Vehicle.o Vehicle..c
  312.     rm Vehicle..c
  313.  
  314. ex13-9: $$@.o ${VEHICLEOBJS} ${NIHCLMILIB}
  315.     $(CC) $@.o -o $@ ${VEHICLEOBJS} ${NIHCLMILIB} ${LFLAGS}
  316.  
  317. # MI and Object I/O readFrom()
  318. ex13-10: $$@.o ${VEHICLEOBJS} ${NIHCLMILIB}
  319.     $(CC) $@.o -o $@ ${VEHICLEOBJS} ${NIHCLMILIB} ${LFLAGS}
  320.  
  321. # Limitation of Object I/O
  322. ex13-11: $$@.o ${VEHICLEOBJS} ${NIHCLMILIB}
  323.     $(CC) $@.o -o $@ ${VEHICLEOBJS} ${NIHCLMILIB} ${LFLAGS}
  324.  
  325. # Exception handling in the NIH Class Library
  326. ex14-1: $$@.o ${NIHCLLIB}
  327.     $(CC) $@.o -o $@ ${NIHCLLIB} ${LFLAGS}
  328.  
  329. # Counted pointers
  330. ex14-2: $$@.o Patient.o ${NIHCLLIB}
  331.     $(CC) $@.o -o $@ Patient.o ${NIHCLLIB} ${LFLAGS}
  332.  
  333. depend:
  334.     echo 'PROGS =' [a-z]*.c | sed -e 's#\([a-zA-Z0-9]*\)\.c#\1#g' >progs.all
  335.     echo 'CLASSES =' [A-Z]*.c | sed -e 's#\([a-zA-Z0-9]*\)\.c#\1.o#g' >classes.all
  336.     touch make.tdep
  337.     makedepend -I$I -I${NIHCLINCDIR} -I${NIHCLVECINCDIR} -f make.tdep -- ${CFLAGS} -- *.c
  338.     sed -e 's#${NIHCLINCDIR}/#$${NIHCLINCDIR}/#g' make.tdep | sed -e 's#${NIHCLVECINCDIR}/#$${NIHCLVECINCDIR}/#g' | sed -e 's# $I/[^     $$]*##g' | sed -e 's# /usr/include/[^  $$]*##g' | sed -e '/:[  ]*$$/d' >make.dep
  339.     rm make.tdep
  340.  
  341. clean:
  342.     -rm -f *.o $(PROGS) *..c *..s core
  343.  
  344. include make.dep
  345.